﻿<%@ Page Language="c#" Inherits="Yorkg.CMS.Web.ExtraBus.Page_Set" EnableEventValidation="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>重新设置所有附件的URL</title>
    <meta http-equiv="x-ua-compatible" content="ie=7" />
    <link rel="icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="main.css" type="text/css" media="all" />
</head>
<script type="text/javascript" src="js/jquery.js"></script>
<link rel="stylesheet" href="js/jquery_boxy/css/common.css" type="text/css" />
<link rel="stylesheet" href="js/jquery_boxy/css/boxy.css" type="text/css" />
<script type="text/javascript" src="js/jquery_boxy/js/jquery.boxy.js"></script>
<script type="text/javascript">
    function SaveOneNode(nodeid) {
        $.ajax(
        {
            type: "GET",
            async: true,
            url: "stepNodesRelation.aspx?type=upfile&nodeid=" + nodeid,
            success: function (data) {
                if (data != "error") {
                    $("#hint_info").append("<br>结点: " + data + " 更新完毕");
                }
                else {
                    $("#hint_info").append("<br>ID为" + nodeid + " 的结点操作失败!");
                }
                CountNum--;
                document.getElementById("inner").scrollTop = 1000000;
                //$("#hint_info").append(CountNum--);
            },
            error: function () {
                $("#hint_info").append("<br>ID为" + nodeid + " 的结点操作失败!");
                CountNum--;
                document.getElementById("inner").scrollTop = 1000000;
            }
        });
    }
    var CountNum = 0;
    var IsAppend = false;
    function SaveAll(nodeids) {
        var nodearray = nodeids.toString().split(",");
        if (nodearray.length > 0) {
            CountNum = nodearray.length;
            for (i = 0; i < nodearray.length; i++) {
                if ((nodearray[i] != "") && (nodearray[i] != "undefined")) {
                    SaveOneNode(nodearray[i]);
                }
            }
            setInterval("ConsoleOK()", 2000);
        }
        else {
            $("#hint_info").append("<br>没有要操作的结点！");
        }
    }
    function ConsoleOK() {
        if (CountNum <= 0 && IsAppend == false) {
            $("#hint_info").append("<br>所有结点已操作完毕！");
            IsAppend = true;
        }
    }
</script>
<body>
    <div class="wrap">
        <div class='side s_clear'>
            <div class='side_bar'>
                <ul>
                    <li class="currentitem">设置结点</li>
                </ul>
                <div class='copy'>
                    河南约克信息技术有限公司</div>
            </div>
        </div>
        <div class="main s_clear">
            <div class="content">
                <h1>
                    执行结果:</h1>
                <div class="info">
                    重新设置所有结点的结点关系：</div>
                <div class="inner" id="inner">
                    <div class="hint_info" id="hint_info">
                        执行进度
                    </div>
                </div>
            </div>
            <div class="btn_box">
                <button type="submit" name="back" id="back" value="true" onclick='SaveAll("<%=LoadAllNode2()%>")'>
                    开始执行</button>
                <button type="submit" name="next" id="next" value="true" onclick="window.close();">
                    关闭</button>
            </div>
        </div>
    </div>
</body>
</html>
